
import {exec} from './SQLDriver.js';
/**
 * 表索引
 * @author xueyanjun
 */
class TableIndex{
	constructor(database,tableName){
		this.tableName = tableName;
		this.database = database;
	}
	
	create(indexName,...columns){
		return exec(this.database,'CREATE INDEX '+indexName+' on '+this.tableName+' ('+columns.toString()+')');
	}
	
	createUnique(indexName,...columns){
		return exec(this.database,'CREATE UNIQUE INDEX '+indexName+' on '+this.tableName+' ('+columns.toString()+')');
	}
	
	drop(indexName){
		return exec(this.database,'DROP INDEX '+indexName);
	}
}

export default TableIndex;